package com.zhangj.alljvm.interviewjvm;

/**
 * @ClassName JVMTest1
 * @Description
 * @Author zhangjie
 * @Date 2022/3/10 18:43
 * @Version 1.0
 */
public class JVMTest1 {
    public static void main(String[] args) {



        System.out.println("剩余空闲堆大小:" + Runtime.getRuntime().freeMemory() / 1024 / 1024 + "M");
        System.out.println("堆的可扩展最大大小:" + Runtime.getRuntime().maxMemory() / 1024 / 1024 + "M");
        System.out.println("堆的当前总大小:" + Runtime.getRuntime().totalMemory() / 1024 / 1024 + "M");

        System.out.println("===============");
        byte[] bytes = new byte[1024 * 1024];

        System.out.println("剩余空闲堆大小:" + Runtime.getRuntime().freeMemory() / 1024 / 1024 + "M");
        System.out.println("堆的可扩展最大大小:" + Runtime.getRuntime().maxMemory() / 1024 / 1024 + "M");
        System.out.println("堆的当前总大小:" + Runtime.getRuntime().totalMemory() / 1024 / 1024 + "M");

        byte[] bytes2 = new byte[64*1024 * 1024];

    }
}
